package com.hjx.movie.persistence.system.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * (IvyRole)实体类
 *
 * @author makejava
 * @since 2020-12-22 14:41:02
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class IvyRole implements Serializable {
    private static final long serialVersionUID = 809171412718304106L;
    @TableId
    private Long roleId;
    @NotBlank(message = "角色名不能为空")
    private String roleName;
    @NotBlank(message = "角色标识码不能为空")
    @Pattern(regexp = "^ROLE_[a-zA-Z0-9]*$",message = "角色标识码不符合规则,必须以ROLE_开头")
    private String roleCode;
    
    private String roleInfo;
    // 1 true 正常 0 锁定
    private Boolean status;

    private Long operatorId;

    private String operatorName;

    private Integer sort;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private List<IvyMenu> menus = new ArrayList<>(10);
    @TableField(exist = false)
    private List<IvyApi> apis = new ArrayList<>(10);
}
